import {payGet, payPost} from "@/services/pay/base-pay-request";
import {ResponseStructure} from "@/requestErrorConfig";
import {AlipayF2FRequest, AlipayF2FResponse} from "@/services/pay/types";

/**
 * 支付宝当面付专用POST请求
 * @param data
 * @param options 额外配置
 */
export async function payAlipayF2F<T>(data: AlipayF2FRequest, options?: Record<string, any>): Promise<ResponseStructure & {
  data?: AlipayF2FResponse
}> {
  return payPost<T>('/alipay/v2/f2f', data, options);
}

/**
 * 支付宝查询订单状态
 * @param orderId 订单号
 */
export async function queryOrderAlipay<T>(orderId: string) {
  return payGet<T>(`/alipay/v2/query/${orderId}`)
}


export async function payWxF2F<T>(data: AlipayF2FRequest, options?: Record<string, any>) {
  return payPost<T>('/wxpay/v2/micropay', data, options);
}

/**
 * 微信查询订单状态
 * @param orderId 订单号
 */
export async function queryOrderWx<T>(orderId: string) {
  return payGet<T>(`/wxpay/v2/query/${orderId}`)
}
